<?php
// +----------------------------------------------------------------------
// | Copyright (c) 2020 All rights reserved.
// +----------------------------------------------------------------------
// | User: Simony <1362229026@qq.com>
// | wechat: Shen86579595
// +----------------------------------------------------------------------

namespace app\common\model\package;

use app\common\model\Base;

use think\db;

class Package extends Base
{
    protected $name='package';


    public function getPackageList($condition = [], $page = 0, $field = 'p.*,m.nickname', $order = 'p.id desc'){
        $res = $this->alias('p')
            ->join('member m1', 'p.member_id=m.id', 'left')
            ->where($condition)
            ->field($field)
            ->order($order);

        if ($page) {
            $res = $res->paginate($page, false, ['query' => request()->param()]);
            $this->page_info = $res;
            $res = $res->toArray();
            return $res['data'];
        } else {
            return $res->select()->toArray();
        }
    }

}
